{template 'common/header'}
 
<ul class="nav nav-tabs">
	<li><a href="{php echo $this->createWebUrl('individual', array('op'=>'display'));}">个人列表</a></li>
	<li {if empty($id)}class="active"{/if}><a href="{php echo $this->createWebUrl('individual', array('op'=>'edit'));}">添加会员</a></li>
	{if !empty($id)}
	<li class="active"><a href="{php echo $this->createWebUrl('individual', array('op'=>'edit', 'id'=>$id));}">会员信息</a></li>
	{/if}
</ul>
 
<div class="main">
	<form action="" method="post" class="form-horizontal form" id="form">
		<div class="panel panel-default">
			<div class="panel-heading">会员信息</div>
				<div class="panel-body">
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label">粉丝编号</label>
	                    <div class="col-sm-8 col-xs-12">
	                    	<input type="text" name="individual[openid]" class="form-control" value="{$individual['openid']}" />
	                    	<span class="input-group-addon"><a href="/web/index.php?c=mc&a=fans&" target="_blank">openid：获取粉丝管理中的粉丝编号</a></span>
	                    </div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">昵称</label>
						<div class="col-xs-12 col-sm-8">
							<input type="text" name="individual[nickname]" class="form-control" value="{$individual['nickname']}" />
							<a>若未填写，则默认微信昵称</a>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">头像</label>
						<div class="col-xs-12 col-sm-8">
							{php echo tpl_form_field_image('individual[avatar]', $individual['avatar']);}
							<a>若未填写，则默认微信头像</a>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">电话</label>
						<div class="col-xs-12 col-sm-8">
							<input type="text" name="individual[phone]" class="form-control" value="{$individual['phone']}" />						
						</div>
					</div>

					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">微信号</label>
						<div class="col-xs-12 col-sm-8">
							<input type="text" name="individual[wxh]" class="form-control" value="{$individual['wxh']}" />						
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">二维码</label>
						<div class="col-xs-12 col-sm-8">
							{php echo tpl_form_field_image('individual[ewm]', $individual['ewm']);}
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">地址</label>
						<div class="col-xs-12 col-sm-8">
							<input type="text" name="individual[address]" class="form-control" value="{$individual['address']}" />						
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">状态</label>
						<div class="col-xs-12 col-sm-8">
							<label class="radio radio-inline">
								<input type="radio" name="individual[status]" value="1" {if intval($individual['status']) != 2}checked="checked"{/if}> 已通过
							</label>
							<label class="radio radio-inline">
								<input type="radio" name="individual[status]" value="2" {if intval($individual['status']) == 2}checked="checked"{/if}> 待审核
							</label>
						</div>
					</div>
					<div class="form-group">
						<div class="col-xs-12 col-sm-9 col-md-10 col-lg-10 col-sm-offset-3 col-md-offset-2 col-lg-offset-2">
							<input type="hidden" name="id" value="{$individual['id']}" />
							<input name="submit" type="submit" value="提交" class="btn btn-primary" />
							<input type="hidden" name="token" value="{$_W['token']}" />
						</div>
					</div>
				</div>
			</div>
		</div>
	</form>
</div>
 
<script>
require(['jquery', 'util'], function($, util){
	$(function(){
		$('#form').submit(function(){
			if($('input[name="business[name]"]').val() == ''){
				util.message('请填写商品名称.');
				return false;
			}			
			if($('input[name="business[logo]"]').val() == ''){
				util.message('请上传商家外观照片.');
				return false;
			}
			if($('input[name="business[phone]"]').val() == ''){
				util.message('请上传商家电话.');
				return false;
			}						
			return true;
		});
	});
});
</script>

{template 'common/footer'}